package testsql;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Q401 {

	public static void main(String[] args) {
		@SuppressWarnings("resource")
		Scanner scanner = new Scanner(System.in);
		while (scanner.hasNext()) {
			String str = scanner.nextLine();
			int num = Integer.valueOf(str);
			Solution solution = new Q401.Solution();
			System.out.println(solution.readBinaryWatch(num));
		}
	}

	
	
	public static class Solution {
	    
		private String[] nums = {"1h","2h","4h","8h","1m","2m","4m","8m","16m","32m"};
		private boolean[] flag = new boolean[nums.length];
		
		private List<String> result = new ArrayList<>();;
		public List<String> readBinaryWatch(int num) {
	        result = new ArrayList<>();
	        if(num<1 || num >8){
	        	if(num == 0){
	        		result.add("0:00");
	        	}
	        	return result;
	        }
	        backTracking(0, num, 0, 0, 0);
	        //Collections.sort(result);
	        return result;
	    }
		
		private void backTracking(int pos, int num, int hour, int min, int count){
			if(count >= num){
				result.add(watchTime(hour, min));
				return;
			}
			for (int i = pos; i < nums.length; i++) {
				if (!flag[i]) {
					String time = nums[i];
					int digit = Integer.valueOf(time.substring(0, time.length() - 1));
					int newHour = hour;
					int newMin = min;
					if (time.charAt(time.length() - 1) == 'h') {
						newHour = hour + digit;
					} else {
						newMin = min + digit;
					}
					if (isOK(newHour, newMin)) {
						flag[i] = true;
						backTracking(i + 1, num, newHour, newMin, count + 1);
						flag[i] = false;
					}
				}
			}
		}

		private boolean isOK(int hour, int min){
	    	if(hour >= 0 && hour <=11 && min >=0 && min <=59){
	    		return true;
	    	}
	    	return false;
	    }
		
		private String watchTime(int hour, int min) {
			StringBuilder sb = new StringBuilder();
			sb.append(hour);
			sb.append(":");
			if(min < 10){
				sb.append("0");
			}
			sb.append(min);
			return sb.toString();
		}
	}
}
